#
#  Be sure to run `pod spec lint DevelopmentPods.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |spec|

  # ―――  Spec Metadata  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  These will help people to find your library, and whilst it
  #  can feel like a chore to fill in it's definitely to your advantage. The
  #  summary should be tweet-length, and the description more in depth.
  #

  spec.name         = "MYModule"
  spec.version      = "0.0.1"
  spec.summary      = "A short description of MYModule."

  # This description is used to generate tags and improve search results.
  #   * Think: What does it do? Why did you write it? What is the focus?
  #   * Try to keep it short, snappy and to the point.
  #   * Write the description between the DESC delimiters below.
  #   * Finally, don't worry about the indent, CocoaPods strips it!
  spec.description  = <<-DESC
                    #{spec.name} module
                   DESC

  spec.homepage     = "http://moyoung/DevelopmentPods"
  # spec.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"


  # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Licensing your code is important. See https://choosealicense.com for more info.
  #  CocoaPods will detect a license file if there is a named LICENSE*
  #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  #

  # spec.license      = "MIT (example)"
  spec.license      = { :type => "MIT", :file => "LICENSE" }


  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the authors of the library, with email addresses. Email addresses
  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  #  accepts just a name if you'd rather not provide an email address.
  #
  #  Specify a social_media_url where others can refer to, for example a twitter
  #  profile URL.
  #

  spec.author             = { "jones" => "jones@moyoung.com" }
  # Or just: spec.author    = "jones"
  # spec.authors            = { "jones" => "jones@moyoung.com" }
  # spec.social_media_url   = "https://twitter.com/jones"

  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If this Pod runs only on iOS or OS X, then specify the platform and
  #  the deployment target. You can optionally include the target after the platform.
  #

  # spec.platform     = :ios
  # spec.platform     = :ios, "5.0"

  #  When using multiple platforms
  # spec.ios.deployment_target = "5.0"
  # spec.osx.deployment_target = "10.7"
  # spec.watchos.deployment_target = "2.0"
  # spec.tvos.deployment_target = "9.0"


  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the location from where the source should be retrieved.
  #  Supports git, hg, bzr, svn and HTTP.
  #

  spec.source       = { :git => "http://moyoung/MYModule.git", :tag => "#{spec.version}" }


  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  CocoaPods is smart about how it includes source code. For source files
  #  giving a folder will include any swift, h, m, mm, c & cpp files.
  #  For header files it will include any header in the folder.
  #  Not including the public_header_files will make all headers public.
  #

  spec.ios.deployment_target = '10.0'
  spec.static_framework = true

# ――― Base Module ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #



  # extensions
  spec.subspec "MYExtensions" do |s|

    myname = "Extensions"
    s.source_files = "MYExtensions/#{myname}/**/*.{h,m,swift}"
    s.public_header_files = "MYExtensions/#{myname}/**/*.{h}"
    
    s.subspec "Rx" do |ss|
      
      ss.source_files = "MYExtensions/#{myname}/Rx/**/*.{h,m, swift}"
      
      ss.dependency "MJRefresh"
      ss.dependency "RxSwift"
      ss.dependency "RxCocoa"
     
    end

  end
  
  # log
  spec.subspec "MYLog" do |s|
    myname = "Log"
    s.source_files = "MYLog/#{myname}/**/*.{h,m,swift}"
    
    s.dependency "XCGLogger"
  end
  
  
  # MYCommon
  spec.subspec "MYCommon" do |s|
    
    myname  = "Common"
    s.source_files = "MYCommon/#{myname}/**/*.{h,m,swift}"
    
    
    s.subspec "Font" do |ss|

      ss.source_files = "MYCommon/#{myname}/Font/*.{h,m, swift}"

    end
    
    s.subspec "Widgets" do |ss|

      ss.source_files = "MYCommon/#{myname}/Widgets/*.{h,m, swift}"
      
    end
    
    s.subspec "Locale" do |ss|

      ss.source_files = "MYCommon/#{myname}/Locale/*.{h,m, swift}"

    end
    
   
    s.subspec "Unit" do |ss|

      ss.source_files = "MYCommon/#{myname}/Unit/*.{h,m, swift}"
      
    end
    
    
  end
  
    
  # frameworks 
  spec.subspec "MYFrameworks" do |s|

    s.libraries = 'c++' ,'c++abi','iconv','resolv.9','resolv','sqlite3','z'
   
    s.subspec "BC" do |ss|
        ss.vendored_frameworks = "MYFrameworks/Frameworks/BCSDK/*.framework"
    end
    s.subspec "OTA" do |ss|
        ss.vendored_frameworks = "MYFrameworks/Frameworks/OTAFramework.framework"
    end
    s.subspec "RTK" do |ss|
        ss.vendored_frameworks = "MYFrameworks/Frameworks/RTKLEFoundation.framework", "MYFrameworks/Frameworks/RTKOTASDK.framework"
    end
    s.subspec "YTHX_ECG" do |ss|
        ss.vendored_frameworks = "MYFrameworks/Frameworks/TYHX_ECG.framework"
    end
    
    s.subspec "eZIP" do |ss|
        ss.vendored_frameworks = "MYFrameworks/Frameworks/eZIPSDK.framework"
    end

    s.subspec "CRPSmartRing" do |ss|
      ss.vendored_frameworks = "MYFrameworks/Frameworks/CRPSmartRing.framework"
  end


  end

  # base UI
  spec.subspec "MYUIKit" do |s|

    myname = "UIKit"

    s.source_files = "MYUIKit/#{myname}/**/*.{h,m,swift}"
    s.public_header_files = "MYUIKit/#{myname}/**/*.{h}"

    s.subspec "NavigationBar" do |ss|
      ss.source_files  =  "MYUIKit/#{myname}/NaVigationBar/**/*.{h,m, swift}"
      ss.source_files  =  "MYUIKit/#{myname}/Views/BarButtonItem.{h,m, swift}"
      
      
      ss.dependency "EachNavigationBar"
      
    end
  
    s.subspec "ViewControllers" do |ss|
      ss.source_files = "MYUIKit/#{myname}/ViewControllers/**/*.{h,m, swift}"
      ss.source_files = "MYUIKit/#{myname}/Views/**/*.{h,m, swift}"
    end
  
#    s.subspec "TabBar" do |ss|
#      ss.source_files = "MYUIKit/#{myname}/TabBar/**/*.{h,m, swift}"
#    end

    s.subspec "Views" do |ss|
      ss.source_files = "MYUIKit/#{myname}/Views/**/*.{h,m, swift}"

    end
    
    
    s.subspec "ViewAttribute" do |ss|
      ss.source_files = "MYUIKit/#{myname}/ViewAttribute/**/*.{h,m, swift}"

    end

  end


# ――― DB  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

  spec.subspec "MYDB" do |s|

    myname = "DB"

    s.source_files = "MYDB/#{myname}/**/*.{h,m,swift,stencil}"
    s.public_header_files = "MYDB/#{myname}/**/*.{h}"
    
    s.dependency "#{spec.name}/MYLog"

    s.dependency 'SQLite.swift', '0.11.5'
    s.dependency 'SwiftDate'
    s.dependency 'HandyJSON'
    s.dependency 'SQLiteValueExtension'
    s.dependency 'Sourcery'
    
    s.subspec "Template" do |ss|
      ss.source_files = "MYDB/#{myname}/Template/*.{h,m,swift,stencil}"
    end
   
  
  end
  

  # ――― MYCharts  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  
  spec.subspec "MYCharts" do |s|
    
    myname  = "Charts"
    s.source_files = "MYCharts/#{myname}/**/*.{h,m,swift}"
    
    s.dependency "#{spec.name}/MYExtensions"
    s.dependency "#{spec.name}/MYUIKit"
    s.dependency "#{spec.name}/MYCommon"
   
    s.dependency "SnapKit"
    s.dependency "Charts"
    s.dependency "RxCocoa"
    s.dependency "RxSwift"
    s.dependency "SwiftDate"
    s.dependency 'RxSwiftExt'
    s.dependency 'NSObject+Rx'
    
  end
  
  
  # ――― ViewModel  ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
    
    spec.subspec "MYViewModel" do |s|
        myname = "ViewModel"

      s.source_files = "MYViewModel/#{myname}/**/*.{h,m,swift}"
      s.public_header_files = "MYViewModel/#{myname}/**/*.{h}"


        s.subspec "Base" do |ss|
          ss.source_files = "MYViewModel/#{myname}/Base/*.{h,m, swift}"
        end
    
#        s.subspec "Sleep" do |ss|
#
#          ss.source_files = "MYViewModel/#{myname}/Sleep/*.{h,m, swift}"
#
#          
#          ss.dependency "#{spec.name}/MYCharts"
#
#          ss.dependency "#{spec.name}/MYViewModel/Base"
#          ss.dependency "HandyJSON"
#
#        end
        
      
    end
    
    
  
end
